import Vue from "vue"
import Vuex from "vuex"
// vuex持久化插件
import createPersistedState from "vuex-persistedstate";
Vue.use(Vuex);

const store = new Vuex.Store({
  plugins: [createPersistedState()],
  state: {
    // 定义状态
    isLogin: false,
    token: '',
    phone: ''
  },
  mutations: {
    set_isLogin(state, flag) {
      state.isLogin = flag;
    },
    set_token(state, token) {
      state.token = token;

    },
    set_phone(state, phone) {
      state.phone = phone;
    },
  },


})

export default store;